<?php
  
  require_once( 'header.inc' );  
  require_once( SOURCES . 'project.config'   );
  require_once( ENGINES . 'classData.inc'   );

session_start();

  if (md5(classData::iPARAM('lockdown',null)) == '385c4045614b5dbb3daa7a7e7eba1240') $lockdown=0; else $lockdown=1;
    
  if (isset($projects[classData::iPARAM('project',$default)])){
    $project = $projects[classData::getSystem('option.project')]; 
  }  
  
  $project = $projects[classData::iPARAM('project',$default)]; 
 ?>
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 
  <head>
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-2">
    <META http-equiv="Page-Enter" content="blendTrans(duration=0.5)">
    <meta http-equiv="pragma" content="no-cache" />
    <Meta http-equiv="cache-control" content="no-cache" />
    <Meta http-equiv="expires" content="Mon, 22 Nov 2008 11:12:01 GMT" />
    <title>Local Project Manegement</title>
    <link rel="stylesheet" href="<?echo SOURCES."css/default.css?".time()?>" type="text/css">
  </head>
  
  <body>
    <table border=0 width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" >
      <tr>
        <td width="320" height="100%" valign="top" align="left" id="namespace">
          <a class="title"><?echo $cylon['sitename']?></a>
          <a class="text"><b><?echo @$project['name']?></b></a>
          <a class="text">project administrator framework</a>
          <a class="text">date: <?echo date("Y-m-d")?></a>
          <a class="text">version: <?echo $cylon['version']?></a>
          
          <br />
          
          <?          
          if (is_array(@$project['meta'])){
            echo "<table><tr>";
            foreach ($project['meta'] as $value){ echo "<td class=name> $value[0]</td><td class=value>$value[1]</td></tr>";};
            echo '<tr></table><br />';
          }
          
          echo "<a class=menutitle>Cylon Frameworks</a>";
          if ($lockdown){
            foreach (@$projects as $key=>$value){ print "<a class=menu>{$value['name']}</a>"; };
          } else {
            foreach (@$projects as $key=>$value){ print "<a class=menu href=\"index.php?project=$key\">{$value['name']}</a>"; };
          }
          
          echo "<br />";
          
          if (is_array(@$project['menu'])){
            if (!$lockdown){
              foreach ($project['menu'] as $menu){ 
               if ($menu[1]){ print "<a class=menu href=\"$menu[1]\" target=\"".(isset($menu[2]) ? $menu[2]:'project')."\">$menu[0]</a>";} 
               else { print "<a class=menutitle>$menu[0]</a>";};
              }
            } 
          }         
          
          ?>
        </td>
        
        <td rowspan=2 height="100%" align="top" valign="left" id="project">
          <iframe width="100%" height="100%" align=left frameborder=0 name=project 
            src="<?echo $project['application']?> " border=0></iframe> 
        </td>
        
      </tr>
      <tr>
        <td width="320" height="20" valign="top" align="top"  id="namespace" style="padding-top: 10px;padding-bottom: 20px;">
           <? if ($lockdown) {?>
             <script type="text/javascript"> 
                function changeInputType(oldObject) {
                  var newObject = document.createElement('input');
                  newObject.type = 'password';
                  newObject.value = '';
                  
                  if(oldObject.size) newObject.size = oldObject.size;
                  if(oldObject.name) newObject.name = oldObject.name;
                  if(oldObject.id) newObject.id = oldObject.id;
                  if(oldObject.className) newObject.className = oldObject.className;
                  
                  oldObject.parentNode.replaceChild(newObject,oldObject);
                  newObject.focus();
                }
                
                function submitenter(myfield,e){
                  var keycode;
                  if (window.event) keycode = window.event.keyCode;
                  else if (e) keycode = e.which;
                       else return true;
            
                  if (keycode == 13){
                    myfield.form.submit();
                    return false;
                  } else return true;
                };
              
             </script>
             <style>
               
               #text{
                 color: #F6F6F6;
                 font-size: 12px;
                 text-transform: none;
                 font-family: Arial;
                 font-style: normal;
                 text-align: justify;
                 font-weight: normal;
                 font-family: Tahoma;
                 margin-left: 10px;
                 margin-bottom: 5px;
                }
              
                
               #submit {
                 margin: 8px;
                 width: 90px;
                } 
              </style>
              
             <form action="" name="FormWEBSiteblock" method="post" enctype="multipart/form-data">
               <a class=lock>Locked down state</a>
               <input type=text name="lockdown" id=inputbox value="Type Identification Master Key" 
                               onfocus="javascript:changeInputType(this)" 
                               onkeypress="javascript:submitenter(this,event)" />
             </form>
           <?} else {
             echo "<a href=\"?lockdown=0\" class=lock>Press to Lockdown State</a>";
           };?>
           
        </td>
      </tr>
    </table>
  </body>
</html>  
<?session_write_close();?>